treeview: check for pixel cache before setting property
authorChristian Hergert <christian@hergert.me>
Thu, 20 Aug 2015 18:13:30 +0000 (11:13 -0700)
committerChristian Hergert <christian@hergert.me>
Thu, 20 Aug 2015 18:13:30 +0000 (11:13 -0700)
Code exists in the wild that calls this function after the widget has
been destroyed (and the pixel cache released). Simply check that the
pixel cache exists to preserve the existing state.

gtk/gtktreeview.c

index a0286a7b3e233ad42701c9e52e637096c1796e07..6de8ff29e7eb094740e15ae91a4ebb8dc8e24339 100644 (file)
@@ -11541,7 +11541,8 @@ gtk_tree_view_set_model (GtkTreeView  *tree_view,
   if (tree_view->priv->selection)
   _gtk_tree_selection_emit_changed (tree_view->priv->selection);
 
-  _gtk_pixel_cache_set_always_cache (tree_view->priv->pixel_cache, (model != NULL));
+  if (tree_view->priv->pixel_cache != NULL)
+    _gtk_pixel_cache_set_always_cache (tree_view->priv->pixel_cache, (model != NULL));
 
   if (gtk_widget_get_realized (GTK_WIDGET (tree_view)))
     gtk_widget_queue_resize (GTK_WIDGET (tree_view));